<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>

<html>
<head>
	<title>商品类别管理</title>
	<meta name="decorator" content="default"/>
	<link href="${ctxStatic}/jquery-treegrid/css/jquery.treegrid.css" rel="stylesheet" type="text/css"/>
	<script src="${ctxStatic}/jquery-treegrid/jquery.treegrid.js" type="text/javascript"></script>
	<script src="${ctxStatic}/jquery-treegrid/jquery.treegrid.bootstrap3.js"></script>
	<%@include file="/WEB-INF/views/include/treetable.jsp" %>
	<script type="text/javascript">
	var i = 1;
		$(document).ready(function() {
			$("#treegrid").treeTable({
				expandLevel : 5,
				});
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/product/catalog/genCatalog/">商品类别列表</a></li>
		<shiro:hasPermission name="product:catalog:genCatalog:edit"><li><a href="${ctx}/product/catalog/genCatalog/form">商品类别添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="genCatalog" action="${ctx}/product/catalog/genCatalog/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>类别名称：</label>
				<form:input path="name" htmlEscape="false" maxlength="45" class="input-medium"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="treegrid" class="table table-striped table-bordered table-condensed col-md-12">
		<thead>
			<tr>
				<th data-options="field:'name'" nowrap="nowrap" class="span6">类别名称</th>
				<shiro:hasPermission name="product:catalog:genCatalog:edit"><th  class="span4">操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="genCatalog" varStatus="ss">
			<c:if test="${genCatalog.pid=='0'}">
				<tr class="treegrid-${genCatalog.id}"  id="${genCatalog.id}" pId="${genCatalog.pid}">
			</c:if>
			<c:if test="${genCatalog.pid!='0'}">
				<tr class="treegrid-${genCatalog.id} treegrid-parent-${genCatalog.pid }" id="${genCatalog.id}" pId="${genCatalog.pid}">
			</c:if>
				<td><a href="${ctx}/product/catalog/genCatalog/form?id=${genCatalog.id}">
					${genCatalog.name}
				</a></td>
				<shiro:hasPermission name="product:catalog:genCatalog:edit">
					<td>
	    				<a href="${ctx}/product/catalog/genCatalog/form?id=${genCatalog.id}">修改</a>
						<a href="${ctx}/product/catalog/genCatalog/delete?id=${genCatalog.id}" onclick="return confirmx('确认要删除该商品类别吗？', this.href)">删除</a>
					</td>
				</shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>